import { REQCATEGORY, USEMOCKBANNER, USEMOCKFLLOR } from "@/api";
import { CATEGORYLIST, REQMOCKBANNER, REQMOCKFLOOR } from '../types';
/**
 * home
 */

const state = {
  categoryList: [],
  bannerList: [],
  floorList: [],
};
const getters = {};
const mutations = {
  [CATEGORYLIST]: (state, commit) => state.categoryList = commit,
  [REQMOCKBANNER]: (state, commit) => state.bannerList = commit,
  [REQMOCKFLOOR]: (state, commit) => state.floorList = commit,
};
const actions = {
  [CATEGORYLIST]: async ({ commit }) => {
    const { data, code } = await REQCATEGORY();
    commit(CATEGORYLIST, data);
  },
  [REQMOCKBANNER]: async ({ commit }) => {
    const { data, code } = await USEMOCKBANNER();
    commit(REQMOCKBANNER, data);
  },
  [REQMOCKFLOOR]: async ({ commit }) => {
    const { data, code } = await USEMOCKFLLOR();
    commit(REQMOCKFLOOR, data);
  }
};

export default {
  state,
  getters,
  mutations,
  actions,
};
